package com.ruoyi.gatewayadmin.service.impl;

import java.util.Date;
import java.util.List;

import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.gatewayadmin.mapper.GatewayAppMapper;
import com.ruoyi.gatewayadmin.domain.GatewayApp;
import com.ruoyi.gatewayadmin.service.IGatewayAppService;

/**
 * 应用管理Service业务层处理
 *
 * @author Darwin
 * @date 2024-10-14
 */
@Service
@DataSource(value = DataSourceType.SLAVE)
public class GatewayAppServiceImpl implements IGatewayAppService
{
    @Autowired
    private GatewayAppMapper gatewayAppMapper;

    /**
     * 查询应用管理
     *
     * @param uuid 应用管理主键
     * @return 应用管理
     */
    @Override
    public GatewayApp selectGatewayAppByUuid(String uuid)
    {
        return gatewayAppMapper.selectGatewayAppByUuid(uuid);
    }

    /**
     * 查询应用管理列表
     *
     * @param gatewayApp 应用管理
     * @return 应用管理
     */
    @Override
    public List<GatewayApp> selectGatewayAppList(GatewayApp gatewayApp)
    {
        return gatewayAppMapper.selectGatewayAppList(gatewayApp);
    }

    /**
     * 新增应用管理
     *
     * @param gatewayApp 应用管理
     * @return 结果
     */
    @Override
    public int insertGatewayApp(GatewayApp gatewayApp)
    {
        return gatewayAppMapper.insertGatewayApp(gatewayApp);
    }

    /**
     * 修改应用管理
     *
     * @param gatewayApp 应用管理
     * @return 结果
     */
    @Override
    public int updateGatewayApp(GatewayApp gatewayApp)
    {
        gatewayApp.setUpdated(new Date());
        gatewayApp.setUpdatedBy(SecurityUtils.getUsername());
        return gatewayAppMapper.updateGatewayApp(gatewayApp);
    }

    /**
     * 批量删除应用管理
     *
     * @param uuids 需要删除的应用管理主键
     * @return 结果
     */
    @Override
    public int deleteGatewayAppByUuids(String[] uuids)
    {
        return gatewayAppMapper.deleteGatewayAppByUuids(uuids);
    }

    /**
     * 删除应用管理信息
     *
     * @param uuid 应用管理主键
     * @return 结果
     */
    @Override
    public int deleteGatewayAppByUuid(String uuid)
    {
        return gatewayAppMapper.deleteGatewayAppByUuid(uuid);
    }
}
